package com.example.demo.vo

import com.example.demo.dbmodels.TJzrBed
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty


@ApiModel(description = "床头卡信息")
class BedVo {
    @ApiModelProperty(name = "id", value = "病床id")
    var id: String = ""

    @ApiModelProperty(name = "districtCode", value = "病房代码")
    var districtCode: String = ""

    @ApiModelProperty(name = "deptCode", value = "科室代码")
    var deptCode: String = ""

    @ApiModelProperty(name = "bedCode", value = "病床代码")
    var bedCode: String = ""

    @ApiModelProperty(name = "bedName", value = "病床名称")
    var bedName: String = ""

    @ApiModelProperty(name = "bedAlias", value = "病床别名")
    var bedAlias: String = ""

    @ApiModelProperty(name = "bedEname", value = "病床英文名")
    var bedEname: String = ""

    @ApiModelProperty(name = "bedType", value = "病床类型")
    var bedType: String = ""

    @ApiModelProperty(name = "bedStatus", value = "病床状态(床位占用状态：0空闲 1使用)")
    var bedStatus: String = ""

    @ApiModelProperty(name = "bedStorey", value = "病床条码")
    var bedStorey: String = ""

    @ApiModelProperty(name = "patientId", value = "病人id")
    var patientId: Int? = -1

    @ApiModelProperty(name = "bedRemark", value = "备注")
    var bedRemark: String = ""

    fun getVo(table: TJzrBed): BedVo {
         table.let {
            val data = BedVo()
            data.id = it.ID
            data.bedAlias = it.BED_ALIAS
            data.bedCode = it.BED_CODE
            data.bedEname = it.BED_ENAME
            data.bedName = it.BED_NAME
            data.bedRemark = it.BED_REMARK
            data.bedStatus = it.BED_STATUS
            data.bedStorey = it.BED_STOREY
            data.bedType = it.BED_TYPE
            data.deptCode = it.DEPT_CODE
            data.districtCode = it.DISTRICT_CODE
            data.patientId = it.PATIENT_ID
            return data
        }
    }

    fun getListVo(table: List<TJzrBed>): List<BedVo> {
        table.let {
            val deptVos = mutableListOf<BedVo>()
            table.forEach {
                val data = BedVo()
                data.id = it.ID
                data.bedAlias = it.BED_ALIAS
                data.bedCode = it.BED_CODE
                data.bedEname = it.BED_ENAME
                data.bedName = it.BED_NAME
                data.bedRemark = it.BED_REMARK
                data.bedStatus = it.BED_STATUS
                data.bedStorey = it.BED_STOREY
                data.bedType = it.BED_TYPE
                data.deptCode = it.DEPT_CODE
                data.districtCode = it.DISTRICT_CODE
                data.patientId = it.PATIENT_ID
                deptVos.add(data)
            }
            return deptVos
        }
    }

}
